-- @owner: @kyeleze
-- @date: 2024/2/3
-- @testpoint: 含有inout类型参数的函数,在另一个函数中调用该函数,调用inout参数

--step01:创建一个函数inout的函数,调用该函数 expect:成功
drop function if exists t_ddl_create_fun_0155;
create or replace function t_ddl_create_fun_0155(i int, inout result_1 bigint, out result_2 bigint)
returns setof record
as $$
begin
    result_1 = result_1 + 1;
    result_2 = i * 10;
return next;
end;
$$language plpgsql;
/

select t_ddl_create_fun_0155(1,2);

--step02:创建另一个函数,调用函数1,调用inout参数,调用该函数 expect:成功
drop function if exists t_ddl_create_fun_0155_01;
create or replace function t_ddl_create_fun_0155_01(i int)
returns void
as $$
begin
   perform t_ddl_create_fun_0155(i,i+1);
end;
$$language plpgsql;
/
select t_ddl_create_fun_0155_01(1);

--step03:清理环境 expect:成功
drop function t_ddl_create_fun_0155;
drop function t_ddl_create_fun_0155_01;
